/** * Copyright 2011 Petr Horinek * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.yacd.web.home.client; import org.yacd.web.home.client.activity.mapper.ActivityMapperImpl; import org.yacd.web.home.client.activity.mapper.IPlaceHistoryMapper; import org.yacd.web.home.client.place.HomePlace; import com.google.gwt.activity.shared.ActivityManager; import com.google.gwt.activity.shared.ActivityMapper; import com.google.gwt.core.client.EntryPoint; import com.google.gwt.core.client.GWT; import com.google.gwt.event.shared.EventBus; import com.google.gwt.place.shared.Place; import com.google.gwt.place.shared.PlaceController; import com.google.gwt.place.shared.PlaceHistoryHandler; import com.google.gwt.place.shared.PlaceHistoryMapper; import com.google.gwt.user.client.ui.RootLayoutPanel; import com.google.gwt.user.client.ui.SimpleLayoutPanel; public class Module implements EntryPoint { private SimpleLayoutPanel rootPanel = new SimpleLayoutPanel(); private Place home = new HomePlace("YaCD Home"); @Override public void onModuleLoad() { ClientFactory factory = GWT.create(ClientFactory.class); EventBus events = factory.getEventBus(); PlaceController places = factory.getPlaceController(); ActivityMapper activityMapper = new ActivityMapperImpl(factory); ActivityManager activityManager = new ActivityManager(activityMapper, events); activityManager.setDisplay(rootPanel); PlaceHistoryMapper historyMapper = GWT .create(IPlaceHistoryMapper.class); PlaceHistoryHandler historyHandler = new PlaceHistoryHandler( historyMapper); historyHandler.register(places, events, home); RootLayoutPanel.get().add(rootPanel); historyHandler.handleCurrentHistory(); } }